<%-- 
    Document   : registro_comprador
    Created on : 10/03/2009, 10:33:16 PM
    Author     : Ricardo
--%>
<%@page session='true'%>
<%@ include file="conexion.jsp" %> 

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>MarketFarm: Productos</title>
    <link rel="STYLESHEET" type="text/css" href="estilos.css">   
    <head><title>Nuevo Producto</title></head>
    <body><center> <div id="header" align="center">
        <img src="images/header.jpg" alt="" width="740" height="220" />
    </div> 
            <%
            String lab_codigo = request.getParameter("lab_codigo");
            String nick = session.getAttribute("nick").toString();
            String lab_nombre = "";
            
            Statement instruccion = null;   
            ResultSet rs = null;
            Connection con = getConexion();
            
            try{
                instruccion = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                //extraemos el codigo de proveedor
                rs =  instruccion.executeQuery("SELECT lab_nombre from laboratorio where lab_codigo='"+lab_codigo+"'");
                while(rs.next()){   
                    lab_nombre = rs.getString(1);
                }
            }   
            catch(Exception e){out.println(e);} 
            %>
        
            <h2>Productos 
            <%  
                out.println(lab_nombre);
            %>
            </h2>
            <table>
                <tr>
                    <th>Nombre</th>
                    <th>Registro Sanitario</th>
                    <th>Clasificación ATC</th>
                    <th>Costo unitario</th>
                    <th> </th>
                </tr>
                <%
                        instruccion = null;   
                        rs = null;
                        con = getConexion();
                        try{
                            instruccion = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                            //extraemos los productos del laboratorio
                            rs =  instruccion.executeQuery("select * from productos where lab_codigo="+lab_codigo+" order by pro_nombre_comercial");
                            while(rs.next()){ 
                                out.println("<tr>");
                                out.println("<td>"+rs.getString(2)+"</td>");
                                out.println("<td>"+rs.getString(3)+"</td>");
                                out.println("<td>"+rs.getString(6)+"</td>");
                                out.println("<td>"+rs.getFloat(8)+"</td>");
                                out.println("<td><a href='#'><font size='-1'>ver presentaciones</font></a></td>");
                                out.println("</tr>");
                            }
                        }   
                        catch(Exception e){out.println(e);} 
                %>                
                
             </table>
            <hr>
            <a href="javascript:history.back()">Regresar</a>
            
        </center>
    </body>
</html>    
